export PYTHONPATH := $(SUMOPATH)/tools:$(TOP)/traci_interface

###
# Variables used by gtest targets
###
TEST_CFLAGS := -g -pthread

GTESTLIB := $(TOP)/libs/gtest-1.6.0/lib/.libs
GTESTINCLUDE := $(GTESTLIB)/include

GTEST_MAIN := $(TOP)/test/unit/gtest_main.o

INCLUDES += -I$(GTESTINCLUDE)
LIBS += -L$(GTESTLIB) -lgtest

ifdef FEATURE
TESTS_FILES := $(addsuffix _feature, $(TESTS))
else 
TESTS_FILES := $(addsuffix _gtest, $(TESTS))
endif

EXE := $(TESTS_FILES)

.PHONE: runtests buildtests

pyunit:
	@echo "\nPYUNIT - Running $(PYTHON_TESTS)" 
	python -m unittest $(PYTHON_TESTS)
	@echo "\n"
	
runtests: $(TESTS_FILES)
	@for exe in $(TESTS_FILES); do \
		echo "\nGTEST - Running $$exe"; \
		./$$exe; \
		echo "\n"; \
	done
	
%_gtest: $(GTEST_MAIN) $(OBJECTS)
	g++ $(TEST_CFLAGS) $(OBJECTS) $< -o $@ $(LIBS)
	
%_feature: $(OBJECTS)
	g++ $(TEST_CFLAGS) $< -o $@ $(LIBS)
